﻿@model Matrix.MaKaYunShang.Model.MagRoles

@{
    ViewBag.Title = "编辑角色";
    ViewBag.PathToBtn = "/MagRole/List";
    ViewBag.TextBtn = "返回至列表";
    Layout = "~/Views/Shared/_Layout.cshtml";
}

<!-- /.row -->
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-heading">
                角色信息
            </div>
            <div class="panel-body">
                <div class="row">
                    @using (Html.BeginForm("Update", "MagRole", FormMethod.Post, new {id = "frmUpdate", enctype = "multipart/form-data"}))
                    {
                        @Html.AntiForgeryToken()
                        @Html.ValidationSummary(true)

                        <div class="col-lg-12">
                            <fieldset>
                                @Html.HiddenFor(model => model.Id)
                                @Html.HiddenFor(model => model.Created)
                                @Html.HiddenFor(model => model.CreatedBy)
                                @Html.HiddenFor(model => model.Disabled)
                                @Html.HiddenFor(model => model.IsDelete)
                                @Html.HiddenFor(model => model.IsMagRole)
                                <div class="form-group col-md-12">
                                    <label>角色名称</label>
                                    <div class="input-group">
                                        @Html.TextBoxFor(model => model.Name, new {@class = "form-control", placeholder = "角色名称"})
                                        <span class="input-group-addon red">必填</span>
                                    </div>
                                </div>
                                <div class="form-group col-md-12">
                                    <label>描述</label>
                                    <div class="input-group">
                                        @Html.TextAreaFor(model => model.Description, new {@class = "form-control", rows = "3", placeholder = "描述"})
                                        <span class="input-group-addon red"></span>
                                    </div>
                                </div>

                                <div class="col-md-12">
                                    <button id="btnSave" type="submit" class="btn btn-primary">确认并保存</button>
                                </div>
                            </fieldset>
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>

@section javascript{
    <script type="text/javascript">
        $(function() {
            $("#frmUpdate").validate({
                rules: {
                    Name: { required: true }
                },
                messages: {
                    Name: { required: "请填写名称" }
                },
                submitHandler: function (form) {
                    form.submit();
                }
            });
        });
    </script>
}